package com.j48.entrancegurad.service.impl;

import com.j48.entrancegurad.mapper.NoticeMapper;
import com.j48.entrancegurad.model.Notice;
import com.j48.entrancegurad.service.INoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class NoticeService implements INoticeService {

    @Autowired
    private NoticeMapper noticedao;

    /**
     * 添加公告
     * @param notice
     * @return
     */
    @Override
    public int insertNotice(Notice notice) {
        return noticedao.insert(notice);
    }

    /**
     * 查询全部公告
     * @return
     */
    @Override
    public ArrayList<Notice> selectAll() {
        return noticedao.selectAll();
    }

    /**
     * 删除公告
     * @param notice
     * @return
     */
    @Override
    public int deleteById(Notice notice) {
        return noticedao.deleteById(notice);
    }

    /**
     * 按id查询公告
     * @param notice
     * @return
     */
    @Override
    public Notice selectone(Notice notice) {
        return noticedao.select(notice);
    }

    /**
     * 按id查询公告并返回集合
     * @param notice
     * @return
     */
    @Override
    public ArrayList<Notice> selectByAdminId(Notice notice) {
        return noticedao.selectByAdminId(notice);
    }
}
